import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

import '../../../widget/price_Widget/index.dart';
import '../models/payments_model.dart';

class PaymentsPriceWidget extends ConsumerStatefulWidget {
  final SummaryModel summary;

  const PaymentsPriceWidget({super.key, required this.summary});

  @override
  _PaymentsPriceWidgetState createState() => _PaymentsPriceWidgetState();
}

class _PaymentsPriceWidgetState extends ConsumerState<PaymentsPriceWidget> {
  @override
  Widget build(BuildContext context) {
    return Container(
      margin: const EdgeInsets.only(top: 10, bottom: 10),
      padding: const EdgeInsets.all(10),
      width: double.infinity,
      height: 120,
      decoration: BoxDecoration(borderRadius: BorderRadius.circular(10), color: Colors.white),
      child: Column(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              const Text("商品總價"),
              PriceWidget(
                price: "${widget.summary.totalPrice}",
                color: Colors.black,
              )
            ],
          ),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              const Text("運費"),
              PriceWidget(
                price: "${widget.summary.postFee}",
                color: Colors.black,
              )
            ],
          ),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [const Text("折扣"), PriceWidget(price: "${widget.summary.discountPrice}")],
          )
        ],
      ),
    );
  }
}
